﻿using System;
using System.Web;
using Easy.BLL;
using Easy.Operation;

namespace Easy.Web.Service.Data
{
    /// <summary>
    /// GetFormData 的摘要说明
    /// </summary>
    public class GetFormData : BaseHttpHandler
    {

        public override void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string entityName = context.Request["entityname"];

            string Id = context.Request["id"];
            string select = context.Request["select"];

            DataService service = new DataService(entityName, this.CurrentUserId);
            string[] cols = null;
            if (!string.IsNullOrWhiteSpace(select)) cols = select.Split(',');
            string json = service.Retrieve(new Guid(Id), cols);

            context.Response.Write(json);
        }

        
    }
}